import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';

import { DataPage } from '../pages/data/data';
import { ContactPage } from '../pages/contact/contact';
import { WarnPage } from '../pages/warn/warn';
import { TabsPage } from '../pages/tabs/tabs';
import { LoginPage } from '../pages/login/login';
import { DetailsPage } from '../pages/details/details'
import { WarnDetailsPage } from '../pages/warn-details/warn-details'
import { StatisticalChartsPage } from '../pages/statistical-charts/statistical-charts';
import { ProjectPage } from '../pages/project/project';
import { PasswordPage } from '../pages/password/password';
import { ListPage } from '../pages/list/list';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';


import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { IntroductionPage } from "../pages/introduction/introduction";
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { HttpClientModule } from '@angular/common/http';

import { LoginService } from "../pages/login/services/login.service";

import { ProjectService } from "../pages/project/services/project.service";
// import { WarnService  } from   "../pages/warm/services/warmService.service";
import { WarnService } from "../pages/warn/services/warnService.service";

import { DataService } from "../pages/data/services/data.service";
import { DetailsService } from "../pages/details/services/details.service";
import { ListService } from "../pages/list/services/list.service";
import { UserService } from "../pages/password/services/user.service";
// import { StompConfig, StompService } from '@stomp/ng2-stompjs';
import { StompService, StompConfig } from '@stomp/ng2-stompjs';
import * as SockJS from 'sockjs-client';


//推送
import { Device } from '@ionic-native/device';
import { JPush } from '@jiguang-ionic/jpush';

const stompConfig: StompConfig = {
  url: () => {
    return new SockJS('http://yyg.server.cloudansys.cn:8088/stomp/natatorium');
  },
  headers: {},
  heartbeat_in: 0,
  heartbeat_out: 20000,
  reconnect_delay: 5000,
  debug: false
};





@NgModule({
  declarations: [
    MyApp,
    DataPage,
    ContactPage,
    WarnPage,
    TabsPage,
    LoginPage,
    IntroductionPage,
    DetailsPage,
    WarnDetailsPage,
    StatisticalChartsPage,
    ProjectPage,
    PasswordPage,
    ListPage,

  ],
  imports: [
    HttpClientModule,
    BrowserModule,
    IonicModule.forRoot(MyApp, {
      mode: 'ios',
      backButtonText: "返回",
      tabsHideOnSubPages: 'true'         //隐藏全部子页面tabs
    }),
    BrowserAnimationsModule,
    FormsModule,
    ReactiveFormsModule,
    NgZorroAntdModule.forRoot()

  ],
  // providers: [{ provide: 'API_URL', useValue: 'http://203.81.246.122:8080/api/'}],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    DataPage,
    ContactPage,
    WarnPage,
    TabsPage,
    LoginPage,
    IntroductionPage,
    DetailsPage,
    WarnDetailsPage,
    StatisticalChartsPage,
    ProjectPage,
    PasswordPage,
    ListPage,

  ],
  providers: [
    WarnService,
    LoginService,
    ProjectService,
    DataService,
    DetailsService,
    StatusBar,
    SplashScreen,
    ListService,
    StompService,
    UserService,
    //推送
    Device,
    JPush,
    { provide: StompConfig, useValue: stompConfig },
    { provide: ErrorHandler, useClass: IonicErrorHandler },
    { provide: 'API_URL', useValue: 'http://yyg.server.cloudansys.cn:8080/api/' }
  ],
})
export class AppModule { }



